import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {TestService} from "../test.service";
import {SettingUrl} from "../../../public/setting/setting_url";

@Component({
  selector: 'app-testOpt-detail',
  templateUrl: './testOpt-detail.component.html',
  styleUrls: ['./testOpt-detail.component.css']
})
export class TestOptDetailComponent implements OnInit {
  private code: string;
  public testOptInfo: any = {};//testOpt信息

  constructor(private testService: TestService, private route: ActivatedRoute, private router: Router) {
  }

  ngOnInit() {
    this.code = this.route.snapshot.params.code;//获取参数
    this.loadTestOptInfo();//查询testOpt类型列表
  }

  /**
   * 查询testOpt信息
   */
  loadTestOptInfo() {
    this.testService.loadTestOptByCode(this.code).then((data: any) => {
      if (data) this.testOptInfo = data;
    })
  }

  /**
   * 修改未设置数据
   */
  toModifyTheUnSetData() {
    this.router.navigate([SettingUrl.ROUTERLINK.testOpt.modify, this.code])
  }

}
